package interfaces.tips;

import org.fenggui.Container;
import org.fenggui.binding.render.ImageFont;
import org.fenggui.event.ButtonPressedEvent;
import org.fenggui.event.IButtonPressedListener;

import interfaces.GUISource;
import interfaces.WordWrapHelper;
import interfaces.superWidgets.InterfaceButton;
import fileHandling.language.LanguageLoader;
import fileHandling.language.interfaces.Tips;

public class TipLangWindow extends TipWindow {
	
	protected ImageFont labelFont;
	protected Tips tip;
	
	public TipLangWindow(int width, int height, Tips tip) {
		super(width, height);
		this.tip = tip;
		
		labelFont = GUISource.middleFont;
		
		init();
		
		layout();
	}
	
	@Override
	protected void init() {
		removeAllWidgets();
		
		InterfaceButton button = new InterfaceButton(labelFont);
		button.setSize(getWidth(), getHeight());
		WordWrapHelper.wrapWords(button, LanguageLoader.get(tip));
		button.setHeight(getHeight());
		addButton(button);
		
		button.addButtonPressedListener(new IButtonPressedListener() {
			@Override
			public void buttonPressed(ButtonPressedEvent e) {
				((Container)getParent()).removeWidget(TipLangWindow.this);
			}
		});
	}
	
	public Tips getTip() { return tip; }
}